import os

def sorted(fname: str)-> list:
    scores = []
    raw_scores = []
    try:
        with open(fname) as f:
            for each_line in f :
                raw_scores.extend(each_line.strip().split(', '))
            for raw_score in raw_scores:
                for letter in raw_score:
                    if letter == '-' or letter == '.':
                        raw_score = raw_score.replace(letter,':')
                if (raw_score not in scores):        
                    scores.append(raw_score)
    except IOError as err:
        print("sorted:",err)
    print("before sorted:", raw_scores)
    print("after sorted:", scores.sort())
    return scores

james = sorted('./ch05/data/james.txt')
print(james)

